import { useLocation } from 'react-router-dom'
import { findParentByChildPath } from '../../Utils'

import LayoutData from '../../Temp/LayoutData'

const Page = ({ smallWindow, routerConfig }) => {
    const { pathname } = useLocation()
    const [, , page, id] = pathname.split('/')
    const data = page ? findParentByChildPath(routerConfig, page, 'router_path') : []

    return (
        <div className={`StartPage ${page}`}>
            <LayoutData key={page} page={page} router={data} smallWindow={smallWindow} />
        </div>
    );
};

export default Page;